home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / OOBEUTIL.JS_ / oobeutil.js
Encoding:
Text File  |  2003-03-24  |  5.7 KB  |  263 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. var ERR_ACT_UNINITIALIZED         = -1;
  8. var ERR_ACT_SUCCESS               = 0;
  9. var ERR_ACT_INACCESSIBLE          = 1;
  10. var ERR_ACT_INVALID_PID           = 2;
  11. var ERR_ACT_USED_PID              = 3;
  12. var ERR_ACT_INTERNAL_WINDOWS_ERR  = 4;
  13. var ERR_ACT_BLOCKED_PID           = 5;
  14. var ERR_ACT_CORRUPTED_PID         = 6;
  15. var ERR_ACT_NETWORK_FAILURE       = 7;
  16. var ERR_ACT_DEDICATED_PID_ENTRY   = 8;
  17.  
  18.  
  19. var g_ProductName = "Windows XP";
  20. var g_ActivationRequired = window.external.NeedActivation();
  21. var g_DoActivation = false;
  22. var g_ActivationStatus = ERR_ACT_UNINITIALIZED;
  23. var g_act_specific_error = 0;
  24. var g_OOBEMUIDir = window.external.GetOOBEMUIPath();
  25.  
  26.  
  27. var L_MissingOEMName_Text = "Error: Missing OEM Name in oobeinfo.ini [Branding] section.";
  28.  
  29.  
  30. var DebugObj = null;
  31.  
  32.  
  33. if (null == DebugObj){
  34.     DebugObj = new Object;
  35.     DebugObj = window.external.Debug;
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. function trace(sMsg)
  47. {
  48.     DebugObj.Trace(sMsg);
  49. }
  50.  
  51.  
  52. function Navigate(strURL)
  53. {
  54.     
  55.     try
  56.     {
  57.        g.document.body.style.cursor = "default";
  58.     }
  59.     catch(e){}
  60.  
  61.     strURL = g_OOBEMUIDir + "\\" + strURL;
  62.  
  63.     trace("Navigate: " + strURL);
  64.     g.navigate(strURL);
  65. }   
  66.  
  67.  
  68. var g_CheckFinishAgain = true;
  69. function CheckFinishStatus()
  70. {
  71.     if (g_CheckFinishAgain)
  72.     {
  73.         if (g_DoActivation)
  74.             g_IsActivationSuccessful = true;
  75.         else
  76.             g_IsActivationSuccessful = false;
  77.         if (g_PostToMS)
  78.             g_IsMSRegistrationSuccessful = true;
  79.         else
  80.             g_IsMSRegistrationSuccessful = false;
  81.  
  82.         if (g_PostToOEM)
  83.             g_IsOEMRegistrationSuccessful = true;
  84.         else
  85.             g_IsOEMRegistrationSuccessful = false;
  86.     }
  87. }
  88.  
  89. <!--REQUIRED FUNCTION NAME-->
  90. function ActivationComplete(status, status_errcode)
  91. {
  92. g_CheckFinishAgain = true;
  93.     if ( status != null) {
  94.  
  95.         g_ActivationStatus = status;
  96.  
  97.         if ( g_ActivationStatus != ERR_ACT_SUCCESS ) {
  98.  
  99.             trace("Activation failed.  Error = " + g_ActivationStatus);
  100.  
  101.             
  102.             g_IsActivationSuccessful      = false;
  103.             g_IsMSRegistrationSuccessful  = false;
  104.             g_IsOEMRegistrationSuccessful = false;
  105.  
  106.             g_act_specific_error = status_errcode;
  107.             GoNavigate(CKPT_ACT_MSG);
  108.             return;
  109.         }
  110.         else
  111.         {
  112.             CheckFinishStatus();
  113.             
  114.             g_CheckFinishAgain = false;
  115.         }
  116.  
  117.         g_ActivationRequired = false;
  118.         g_DoActivation = false;
  119.         StatusObj.set_Status(MS_REGISTRATION, true);
  120.     }
  121.  
  122.     if (g_PostToOEM)
  123.     {
  124.         if (0 == RegisterObj.get_OEMAddRegPage)
  125.         {
  126.             window.external.PostRegData(POST_TO_OEM);
  127.             StatusObj.set_Status(OEM_REGISTRATION, true);
  128.             g_IgnoreDialErr = true;
  129.             PopCKPT(CKPT_REGDIAL);
  130.             PopCKPT(CKPT_REGISTER3);
  131.             PopCKPT();    
  132.             CheckFinishStatus();
  133.             if (InReminderMode())
  134.                 GoNavigate(CKPT_ACT_MSG);      
  135.             else
  136.                 GoNavigate(CKPT_ICONN);        
  137.         }
  138.         else
  139.         {
  140.             
  141.             
  142.             
  143.             
  144.             g_IgnoreDialErr = true;
  145.  
  146.             if ( APP_REG_MODE == window.external.Directions.get_AppMode() )
  147.             {
  148.                 Navigate("html\\oemreg\\roemadd.htm");
  149.             }
  150.             else
  151.             {
  152.                 Navigate("html\\oemreg\\oemadd.htm");
  153.             }
  154.         }
  155.     }
  156.     else
  157.     {
  158.         g_IgnoreDialErr = true;
  159.  
  160.         PopCKPT(CKPT_REGDIAL);
  161.         PopCKPT(CKPT_REGISTER3);
  162.         PopCKPT();    
  163.         CheckFinishStatus();
  164.         if (InReminderMode())
  165.             GoNavigate(CKPT_ACT_MSG);    
  166.         else
  167.             GoNavigate(CKPT_ICONN);      
  168.     }
  169.  
  170.     if ((g_PostToMS && g_PostToOEM && (1 == RegisterObj.get_PostToOEM)) ||
  171.         ((0 == RegisterObj.get_PostToOEM) && g_PostToMS))
  172.     {
  173.         if ( APP_REG_MODE == window.external.Directions.get_AppMode() )
  174.         {
  175.             
  176.             
  177.             
  178.             window.external.StopRemind(REMIND_REG);
  179.         }
  180.         else
  181.         {
  182.             
  183.             
  184.             
  185.             window.external.DeleteRemind(REMIND_REG);
  186.         }
  187.     }
  188. }
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. var SORT_DEFAULT                = 0x0;     
  196.  
  197. var LANG_JAPANESE               = 0x11;
  198. var LANG_KOREAN                 = 0x12;
  199. var LANG_CHINESE                = 0x04;
  200.  
  201. var SUBLANG_KOREAN              = 0x01;    
  202. var SUBLANG_CHINESE_TRADITIONAL = 0x01;    
  203. var SUBLANG_CHINESE_SIMPLIFIED  = 0x02;    
  204. var SUBLANG_DEFAULT             = 0x01;    
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214. function MAKELANGID(p, s)
  215. {
  216.     return (( s << 10) | p);
  217. }
  218.  
  219. function MAKELCID(lgid, srtid)
  220. {
  221.     return ((srtid << 16) | lgid);
  222. }
  223.  
  224. function IsKoreanLocale() {
  225.    var language = ApiObj.get_UserDefaultUILanguage();
  226.    if (language == MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN), SORT_DEFAULT)) {
  227.       return true;
  228.    }
  229.  
  230.    return false;
  231. }
  232.  
  233. function IsFarEastLocale()
  234. {
  235.     
  236.     
  237.     var language = ApiObj.get_UserDefaultUILanguage();
  238.  
  239.     if (language == MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN), SORT_DEFAULT) ||
  240.         language == MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), SORT_DEFAULT) ||
  241.         language == MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT) ||
  242.         language == MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT))
  243.         return true
  244.     else
  245.         return false;
  246. }
  247.  
  248. function StorePid()
  249. {
  250.     var strPid = "";
  251.  
  252.     for (var i = 0; i < 4; i++)
  253.     {
  254.         strPid += g.edtProductKey[i].value;
  255.         strPid += '-';
  256.     }
  257.  
  258.     strPid += g.edtProductKey[i].value;
  259.  
  260.     PidObj.set_PID(strPid);
  261. }
  262.  
  263.